import java.util.Arrays;

public class Test03 {

    public static int countSegments(String s) {
        if(s.equals("")){
            return 0;
        }
        String[] str = s.split(" +");
        System.out.println(Arrays.asList(str));
        return str.length;
    }

    public static void main(String[] args) {

        String str = "      foo     bar";
        countSegments(str);

    }
}

class TestClass {

    private static void testMethod(){

        System.out.println("testMethod");

    }

    public static void main(String[] args) {

        ((TestClass)null).testMethod();

    }

}

